hypot
Calculate the oblique length of a straight triangle
hypot()
function calculates the length of the oblique side of a straight triangle.
<?php echo hypot ( 2 , 3 ) ; echo hypot ( 3 , 6 ) ; echo hypot ( 3 , 6 ) ; echo hypot ( 1 , 3 ) ; ?>
Try it yourself
hypot ( x , y )
parameter | describe |
---|---|
x | Required. The length of the edge x. |
y | Required. The length of the edge y. |
hypot()
function will calculate the length of the oblique side according to the two straight solution edge lengths x and y of a right triangle. Or the distance from punctuation point (x, y) to the origin. The algorithm of this function is equivalent to sqrt(x*x + y*y).